# 设置需要的C++版本号
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# rpath
set(CMAKE_SKIP_BUILD_RPATH FALSE)                 # 编译时加上RPATH  
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)          # 编译时RPATH不使用安装的RPATH  
set(CMAKE_INSTALL_RPATH "${CMAKE_BINARY_DIR}/lib")# 安装RPATH为空  
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)       # 安装的执行文件加上RPATH
# 源文件
file(GLOB_RECURSE LIVE_STREAM_SOURCES  "${CMAKE_CURRENT_SOURCE_DIR}/*.h" 
                                "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp" 
                                "${CMAKE_CURRENT_SOURCE_DIR}/*.c" 
                                "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" 
                                "${CMAKE_CURRENT_SOURCE_DIR}/*.cc")

message("sources includes ${LIVE_STREAM_SOURCES}") 

# 生成可执行文件
add_executable(live_stream ${LIVE_STREAM_SOURCES})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
INCLUDE_DIRECTORIES(${LIVE_STREAM_SOURCE_DIR}/third_src/spdlog/include)
# 添加依赖
# add_dependencies(live_stream
#     # libyamlcpp
#     # libboost-1.80.0
# )
# 安装路径(前面我们设置了 CMAKE_INSTALL_PREFIX这个变量，也就是安装到了这个工程的bin目录)
install(TARGETS live_stream RUNTIME DESTINATION bin)
# 链接
target_link_libraries(live_stream
    boost_system.a
    boost_serialization.a
    boost_date_time.a
    boost_regex.a
    boost_coroutine.a
    boost_thread.a
    boost_context.a
    boost_program_options.a
    libjsoncpp.a
)
